<?php require_once 'source.php';?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title><?php echo LOGINTILLE?></title>
<link rel="stylesheet" type="text/css" href="css/style.css" />
<script type="text/javascript" src="../js/login.js"></script>
</head>
<body class="bg">
<div class="wrapper">
<?php 
function print_msg(){
	if(isset($_GET['msg'])){
		if($_GET['msg']=='nosuchuser'){//illegal user
			$msg = NOSUCHUSER;
		}elseif($_GET['msg']=='signout'){//exit system
			$msg = SIGNOUT;
		}elseif($_GET['msg']=='useriderror'){//userid is not a numeric
			$msg = USERIDERROR;
		}
		return $msg;
	}
}
function clear_session(){//quit system
	session_start();
	unset($_SESSION['userid']);
	unset($_SESSION['username']);
	unset($_SESSION['password']);
	unset($_SESSION['level']);
}
clear_session();
?>
<div id="login">
	<div class="login_title"><?php echo LOGINTILLE?></div>
	<div id="usermsg"><?php echo print_msg();?></div>
	<form name="login" action="service/service_login.php" method="post">
		<div id="login_userid">
			<span><?php echo USERID?></span>:
			<input type="text" name="username" value="<?php if(isset($_GET['username'])){echo $_GET['username'];}?>"/>
		</div>
		<div id="login_password">
			<span><?php echo PASSWORD?></span>:
			<input type="password" name="password"/>
		</div>
		<div id="login_submit">
			<input type="submit" value="<?php echo SIGNIN?>"/>
		</div>
	</form>
</div>
<div id="copyright">
	<span><?php echo COPYRIGHT?></span>
	<a href="mailto:<?php echo AUTHER?>"><?php echo CONTACTAUTHER?></a>
</div>
</div>
</body>
</html>